home *** CD-ROM | disk | FTP | other *** search
/ Georgia Wildfire Prevention / Georgia Wildfire Prevention.iso / mac / media / dirs / BackUp / WildFire.dir / 00007_Script_Question Behavior < prev    next >
Text File  |  2002-10-15  |  3KB  |  81 lines

  1. --QUESTION BEHAVIOR--
  2. global Neptune
  3. property QuestionType, CorrectAnswer, QuestionA, QuestionB, QuestionC, QuestionD, QuestionSound, RightSound, WrongSound,AnsweredCorrectly, \
  4. SpNum, MemNum, MyMem, CurrentQuestion
  5.  
  6. on new me
  7.   SpNum = me.spritenum
  8.   mm=sprite(spnum).member
  9.   MemNum =mm.number
  10.   MyMem = mm.name  
  11.   AnsweredCorrectly = 0
  12.   CurrentQuestion = 0
  13. end
  14.  
  15. on getpropertydescriptionlist me,
  16.   set pList = [\
  17.  #QuestionType: [#comment: "Will the question be True/False or Multiple Chioce? ",  #format: #string, #range: ["True/False", "Multiple Choice"], #default: "True/False"],\
  18.  #CorrectAnswer: [#comment: "What is the correct answer for this question? ", #format: #string,  #range: ["True", "False", "A", "B", "C", "D"], #default: "True"],\
  19.  #QuestionA: [#comment: "Question A:", #format:#string, #default: ""],\
  20.  #QuestionB: [#comment: "Question B:", #format:#string, #default: ""],\
  21.  #QuestionC: [#comment: "Question C:", #format:#string, #default: ""],\
  22.  #QuestionD: [#comment: "Question D:", #format:#string, #default: ""],\
  23.  #QuestionSound: [#comment: "What sound would you like to play for the question?", #format:#string, #default: ""],\
  24.   #RightSound: [#comment: "What sound would you like to play for a correct answer?", #format:#string, #default: ""],\
  25.  #WrongSound: [#comment: "What sound would you like to play for a wrong answer?", #format:#string,#default: ""]\
  26.   ]
  27.   return pList
  28. end
  29.  
  30. --Let's QuestionGod object know that it is available for asking.
  31. on AvailableQuestions me
  32.   if AnsweredCorrectly = 0 then
  33.     AvailabilityResponse(Neptune, SpNum)
  34.   end if
  35. end
  36.  
  37. --If the Next question's sprite number doesn't match, the spite goes dark. Else, it lights up.
  38. on LightsOut me, NextQuestion
  39.   if SpNum <> NextQuestion then
  40.     sprite(SpNum).visible = 0
  41.     CurrentQuestion = 0
  42.   else
  43.     sprite(SpNum).visible = 1
  44.     CurrentQuestion = 1
  45.     sound(1).play(member(QuestionSound))
  46.   end if
  47. end
  48.  
  49. --If the ButtonAnswer = my answer, I am no longer available to ask.
  50. on ClickedButton me, ButtonAnswer
  51.   if CurrentQuestion = 1 then
  52.     sound(1).stop()
  53.     if ButtonAnswer = CorrectAnswer then
  54.       AnsweredCorrectly = 1
  55.       sound(1).play(member(RightSound))
  56.     else if ButtonAnswer <> CorrectAnswer then
  57.       sound(1).play(member(WrongSound))
  58.     end if 
  59.     repeat while soundbusy(1)
  60.       nothing
  61.     end repeat
  62.   end if
  63. end
  64.  
  65. on beginsprite me
  66.   sprite(spnum).visible=0
  67.   updatestage
  68. end
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.